/**
 * @program: LeetCode
 * @description: LeetCode : 83. 删除排序链表中的重复元素
 * @author: WXY
 * @create: 2023-01-02 15:08
 * @Version 1.0
 **/
public class num083_deleteDuplicates {
    public ListNode deleteDuplicates(ListNode head) {
        if (head == null) return null;
        ListNode cur = head;
        while (cur.next != null) {
            if (cur.val == cur.next.val) {
                cur.next = cur.next.next;
            } else {
                cur = cur.next;
            }
        }
        return head;
    }

    class ListNode {
        int val;
        ListNode next;

        ListNode(int x) {
            val = x;
            next = null;
        }
    }
}
